package flc.ast.adapter;


import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.HourBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class HourAdapter extends StkProviderMultiAdapter<HourBean> {


    public HourAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new HourProvider());
    }

    private class HourProvider extends BaseItemProvider<HourBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_hour;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, HourBean bean) {
            baseViewHolder.setText(R.id.tvHourItemNum, bean.getNum() + "");
            if (bean.isSelected()) {
                baseViewHolder.setBackgroundResource(R.id.rlHourItem, R.drawable.xz);
                baseViewHolder.setTextColor(R.id.tvHourItemNum, Color.parseColor("#FFFFFF"));
            } else {
                baseViewHolder.setBackgroundResource(R.id.rlHourItem, R.drawable.wxz);
                baseViewHolder.setTextColor(R.id.tvHourItemNum, Color.parseColor("#000000"));

            }
        }
    }

}
